ACTOR DualRifles : Schism_BaseWeapon
{
	Weapon.AmmoType1 "DoubleRifleAmmo"
	Weapon.AmmoGive1 0
	Weapon.AmmoUse1 1
	Weapon.AmmoType2 "Clip2"
	Weapon.AmmoGive2 0
	Weapon.AmmoUse2 0
	Weapon.SelectionOrder 5100
	+WEAPON.NO_AUTO_SWITCH
    +WEAPON.NOAUTOAIM
	+WEAPON.NOAUTOFIRE
	+WEAPON.AMMO_OPTIONAL
	+WEAPON.ALT_AMMO_OPTIONAL
	+WEAPON.ALT_USES_BOTH
	+WEAPON.NOALERT
	Obituary "%o was drilled by %k's Double Rifles."
	Inventory.ForbiddenTo Sorcerer, Corvus
	Inventory.Pickupmessage ""
	AttackSound "None"
	Tag "Dual Rifles"
	Scale 0.6
	States
	{
		Spawn:
			RIFL B -1
			Stop
		
		Select:
			P2SS A 0 A_Raise
			Wait
			
		Deselect:
			P2SS FEDCBA 1
			DeselectLoop:
			"####" "#" 0 A_Lower
			Wait
			
		Ready:
			P2SS A 0 A_PlaySound("CLIPIN", 3)
			P2SS ABCDEF 1 A_WeaponReady(WRF_NOFIRE)
			ReadyLoop:
			TNT1 A 0 A_JumpIfInventory("Taunting", 1, "Taunt")
			TNT1 A 0 A_JumpIfInventory("Kicking", 1, "DoKick")
			TNT1 A 0 A_JumpIfInventory("Salute1", 1, "ClearInv")
			TNT1 A 0 A_JumpIfInventory("Salute2", 1, "ClearInv")
			TNT1 A 0 A_JumpIfInventory("Quickspell", 1, "ClearInv")
			TNT1 A 0 A_JumpIfInventory("Reloading", 1, "Reload")
			TNT1 A 0 A_JumpIfInventory("TossGrenade", 1, "TossGrenade")
			TNT1 A 0 A_JumpIfInventory("StartDualWield", 1, "DualWield")
			P2SG A 1 A_WeaponReady
			Loop
			
		Fire: //4 tics
			P2W2 A 0 A_JumpIf(ACS_NamedExecuteWithResult("Check_DeltaTouchGaming") != 0, "FireBoth")
			P2W2 A 0 A_JumpIfInventory("LeftRifleAmmo", 1, 1)
			Goto ReadyLoop
			P2W2 A 0 A_JumpIfInventory("FiredSecondary", 1, "FireBoth")
			P2W2 A 0 A_GunFlash("RightGunFlash")
			"####" "#" 0 A_AlertMonsters
			"####" "#" 0 A_PlayWeaponSound("weapons/rifle")
			"####" "#" 0 A_FireCustomMissile("GunFireSmoke", 0, 0, -5, 0, 0, 0)
			"####" AB 1 Bright
			"####" C 1 ACS_NamedExecuteWithResult("Schism_FireBullet", 20, 0, 12, 20)  //A_FireBullets(12, 3, 1, 20, "HitPuff", 1)
			"####" "#" 0 A_TakeInventory("LeftRifleAmmo", 1)
			"####" "#" 0 A_TakeInventory("DoubleRifleAmmo", 1)
			"####" "#" 0 A_FireCustomMissile("Tracer", 2, 0, -8, -3, 0, random(-1, 1))
			"####" "#" 0 A_SetPitch(Pitch + 0.6)
			"####" D 1 A_FireCustomMissile("RifleCaseSpawn", 0, 0, -20, -10)
			"####" "#" 0 A_SetPitch(Pitch - 0.6)
			//"####" "#" 0 A_ReFire
			Goto Refire
		
		AltFire:
			P2W2 A 0 A_JumpIf(ACS_NamedExecuteWithResult("Check_DeltaTouchGaming") != 0, "FireBoth")
			P2W2 A 0 A_JumpIfInventory("RifleAmmo", 1, 1)
			Goto ReadyLoop
			P2W2 A 0 A_JumpIfInventory("FiredPrimary", 1, "FireBoth")
			P2W1 A 0 A_GunFlash("LeftGunFlash")
			"####" "#" 0 A_AlertMonsters
			"####" "#" 0 A_PlayWeaponSound("weapons/rifle")
			"####" "#" 0 A_FireCustomMissile("GunFireSmoke", 0, 0, 5, 0, 0, 0)
			"####" AB 1 Bright
			"####" C 1 ACS_NamedExecuteWithResult("Schism_FireBullet", -20, 0, 12, 20)   //A_FireBullets(12, 3, 1, 20, "HitPuff", 1)
			"####" "#" 0 A_TakeInventory("RifleAmmo", 1)
			"####" "#" 0 A_TakeInventory("DoubleRifleAmmo", 1)
			"####" "#" 0 A_FireCustomMissile("Tracer", -2, 0, 8, -3, 0, random(-1, 1))
			"####" "#" 0 A_SetPitch(Pitch + 0.6)
			"####" D 1 A_FireCustomMissile("RifleCaseSpawn", 0, 0, 20, -10)
			"####" "#" 0 A_SetPitch(Pitch - 0.6)
			//"####" "#" 0 A_ReFire
			Goto Refire
			
		FireBoth:
			P2W2 A 0 A_JumpIfInventory("LeftRifleAmmo", 1, 1)
			Goto ReadyLoop
			P2W3 A 0 A_JumpIfInventory("RifleAmmo", 1, 1)
			Goto ReadyLoop
			P2W3 A 0 
			"####" "#" 0 A_AlertMonsters
			"####" "#" 0 A_PlaySound("weapons/rifle", CHAN_WEAPON)
			"####" "#" 0 A_PlaySound("weapons/rifle", CHAN_5)
			"####" "#" 0 A_FireCustomMissile("GunFireSmoke", 0, 0, -5, 0, 0, 0)
			"####" "#" 0 A_FireCustomMissile("GunFireSmoke", 0, 0, 5, 0, 0, 0)
			"####" "#" 0 A_TakeInventory("DoubleRifleAmmo", 2)
			"####" "#" 0 A_TakeInventory("RifleAmmo", 1)
			"####" "#" 0 A_TakeInventory("LeftRifleAmmo", 1)
			"####" AB 1 Bright
			"####" C 1 ACS_NamedExecuteWithResult("Schism_FireBullet", 20, 0, 12, 20) //A_FireBullets(12, 3, 1, 10, "HitPuff", 1)
			"####" "#" 0 ACS_NamedExecuteWithResult("Schism_FireBullet", -20, 0, 12, 20) //A_FireBullets(12, 3, 1, 10, "HitPuff", 1)
			"####" "#" 0 A_FireCustomMissile("Tracer", 2, 0, -8, -3, 0, random(-1, 1))
			"####" "#" 0 A_FireCustomMissile("Tracer", -2, 0, 8, -3, 0, random(-1, 1))
			"####" "#" 0 A_SetPitch(Pitch + 0.6)
			"####" D 1 A_FireCustomMissile("RifleCaseSpawn", 0, 0, -20, -10)
			"####" "#" 0 A_FireCustomMissile("RifleCaseSpawn", 0, 0, 20, -10)
			"####" "#" 0 A_SetPitch(Pitch - 0.6)
			"####" "#" 0 A_JumpIfInventory("FiredSecondary", 1, "AltFire")
			//"####" "#" 0 A_ReFire
			Goto Refire
			
		Refire:
			TNT1 A 0 A_JumpIfInventory("FiredPrimary", 1, "Fire")
			TNT1 A 0 A_JumpIfInventory("FiredSecondary", 1, "AltFire")
			Goto ReadyLoop
			
		Reload:
			TNT1 A 0 A_TakeInventory("Reloading", 1)
			TNT1 A 0 A_JumpIfInventory("LeftRifleAmmo", 31, "ReloadRight")
			TNT1 A 0 A_JumpIfInventory("Clip2", 1, 1)
			Goto ReadyLoop
			P2SS FEDCBA 1
			TNT1 A 5
			TNT1 A 0 A_PlaySound("RELOAD", 1)
			TNT1 A 0 A_FireCustomMissile("EmptyClipSpawn", 185, 0, 8, -4)
			R2RR ABCDDDDDDEFGHIIJJKLMNO 1
			TNT1 A 5
			P2SS ABCDEF 1
			P2SS F 0 A_JumpIfInventory("LeftRifleAmmo", 1, "RefillLeftTo31")
			Goto RefillLeftTo30
			
		ReloadRight:
			TNT1 A 0 A_JumpIfInventory("RifleAmmo", 31, "ReadyLoop")
			TNT1 A 0 A_JumpIfInventory("Clip2", 1, 1)
			Goto ReadyLoop
			P2SS FEDCBA 1
			TNT1 A 5
			TNT1 A 0 A_PlaySound("RELOAD", 1)
			TNT1 A 0 A_FireCustomMissile("EmptyClipSpawn", -5, 0, 8, -4)
			R2RL ABCDDDDDDEFGHIIJJKLMNO 1
			TNT1 A 5
			P2SS ABCDEF 1
			P2SS F 0 A_JumpIfInventory("RifleAmmo", 1, "RefillRightTo31")
			Goto RefillRightTo30
			
		RefillLeftTo30:
			TNT1 A 0 A_TakeInventory("Clip2", 1)
			TNT1 A 0 A_GiveInventory("DoubleRifleAmmo", 1)
			TNT1 A 0 A_GiveInventory("LeftRifleAmmo", 1)
			TNT1 A 0 A_JumpIfInventory("LeftRifleAmmo", 30, "ReloadRight")
			TNT1 A 0 A_JumpIfInventory("Clip2", 1, "RefillLeftTo30")
			Goto ReadyLoop
			
		RefillLeftTo31:
			TNT1 A 0 A_TakeInventory("Clip2", 1)
			TNT1 A 0 A_GiveInventory("DoubleRifleAmmo", 1)
			TNT1 A 0 A_GiveInventory("LeftRifleAmmo", 1)
			TNT1 A 0 A_JumpIfInventory("LeftRifleAmmo", 31, "ReloadRight")
			TNT1 A 0 A_JumpIfInventory("Clip2", 1, "RefillLeftTo31")
			Goto ReadyLoop
			
		RefillRightTo30:
			TNT1 A 0 A_TakeInventory("Clip2", 1)
			TNT1 A 0 A_GiveInventory("DoubleRifleAmmo", 1)
			TNT1 A 0 A_GiveInventory("RifleAmmo", 1)
			TNT1 A 0 A_JumpIfInventory("RifleAmmo", 30, "ReadyLoop")
			TNT1 A 0 A_JumpIfInventory("Clip2", 1, "RefillRightTo30")
			Goto ReadyLoop
			
		RefillRightTo31:
			TNT1 A 0 A_TakeInventory("Clip2", 1)
			TNT1 A 0 A_GiveInventory("DoubleRifleAmmo", 1)
			TNT1 A 0 A_GiveInventory("RifleAmmo", 1)
			TNT1 A 0 A_JumpIfInventory("RifleAmmo", 31, "ReadyLoop")
			TNT1 A 0 A_JumpIfInventory("Clip2", 1, "RefillRightTo31")
			Goto ReadyLoop
		
		NoAmmo:
			TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, 2)
			Goto Reload
			TNT1 A 0 A_JumpIfInventory("TurboReload", 1, "RefillTo60")
			TNT1 A 0 A_PlayWeaponSound("weapons/empty")
			P2SG A 1 A_PlayWeaponSound("weapons/empty")
			Goto ReadyLoop
		
		DualWield:
			P2SS A 0
			"####" "#" 0 A_TakeInventory("StartDualWield", 1)
			"####" "#" 0 A_SelectWeapon("Rifle")
			Goto ReadyLoop
			
		DoKick: //14 tic
			TNT1 A 0 A_GunFlash("KickFlash")
			TNT1 A 0 A_TakeInventory("Kicking", 1)
			TNT1 A 0 A_JumpIfInventory("PowerStrength", 1, "DoKickWithBerserk")
			TNT1 A 0 A_PlaySound("KICK")
			TNT1 A 0 SetPlayerProperty(0, 1, 0)
			K1CK A 0 A_JumpIfInventory("IsPaladin", 1, 2)
			KICK A 0
			"####" BCD 1
			"####" A 0 A_FireCustomMissile("KickAttack", 0, 0, 0, -7)
			"####" H 3 
			"####" IGF 1
			"####" "#" 0 SetPlayerProperty(0, 0, 0)
			"####" EDCBA 1
			Goto ReadyLoop
			
		DoKickWithBerserk:
			TNT1 A 0 A_PlaySound("KICK")
			K1CK A 0 A_JumpIfInventory("IsPaladin", 1, 2)
			KICK A 0
			"####" BCD 1
			"####" A 0 A_FireCustomMissile("SuperKickAttack", 0, 0, 0, -7)
			"####" H 3
			"####" IGF 1
			"####" ED 1
			"####" CBA 1 
			Goto ReadyLoop
		
		Taunt:
			"####" "#" 0 A_TakeInventory("Taunting", 1)
			"####" "#" 0 A_Print("Your both arms is holding weapons, you can't offend.", -30)
			Goto ReadyLoop
			
		TossGrenade:
			"####" "#" 0 A_TakeInventory("TossGrenade", 1)
			"####" "#" 0 A_Print("Your both arms is holding weapons, you can't throw grenade.", -30)
			Goto ReadyLoop
			
		ClearInv:
			"####" "#" 0 A_TakeInventory("Quickspell", 1)
			"####" "#" 0 A_TakeInventory("Salute1", 1)
			"####" "#" 0 A_TakeInventory("Salute2", 1)
			Goto ReadyLoop
			
		RightGunFlash:
			P2W1 A 4
			Stop
			
		LeftGunFlash:
			P2W2 A 4
			Stop
			
		KickFlash:
			P2SG A 14
			Stop
	}
}

ACTOR LeftRifleAmmo : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 31
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 31
   Inventory.Icon "RIFLA0"
}